/*
    XTU OJ: 1319
    Table generation
    by: fifth_light
*/

#include <stdio.h>

int main(void) {
    int prime_table[100050] = {1, 1, 0};
    for (int i = 2; i < 317; (i == 2) ? (i++) : (i += 2)) {
        for (int j = i * 2; j < 100050; j += i) {
            prime_table[j] = 1;
        }
    }
    
    int prime_count = 0;
    int primes[100050] = {0};
    for (int i = 2; i < 100050; i++) {
        if (prime_table[i] == 0) {
            primes[prime_count++] = i;
        }
    }
    
    puts("int main(void) {");
    int divisors[300];
    int divisor_count = 0;
    for (int j = 2; j < 100050; j++) {
        int a = j;
        int nums[10][2] = {0};
        int num = 0;
        int all = 0;
        for (int i = 0; i < prime_count; i++) {
            int prime = primes[i];
            int hit = 0;
            int exit = 0;
            while (a % prime == 0) {
                hit = 1;
                a /= prime;
                all++;
                nums[num][1]++;
                if (all == 10) {
                    goto next_num;
                }
                if (a == 1) {
                    exit = 1;
                }
            }
            if (hit) {
                nums[num][0] = prime;
                num++;
            }
            if (exit == 1) {
                break;
            }
        }
        int count = 1;
        for (int i = 0; i < num; i++) {
            count *= nums[i][1] + 1;
        }
        if (count == 3 || count == 5) {
            int divisor_pos = -1;
            int divisor = nums[0][0];
            for (int j = 0; j < divisor_count; j++) {
                if (divisors[j] == divisor) {
                    divisor_pos = j;
                    break;
                }
            }
            if (divisor_pos == -1) {
                divisor_pos = divisor_count++;
                divisors[divisor_pos] = divisor;
            }
            printf("    table[%d][0] = %d;\n"
                "    table[%d][1] = %d;\n", j, divisor_pos, j, nums[0][1]);
        }
        next_num:;
    }
    putchar('\n');
    for (int j = 0; j < divisor_count; j++) {
        printf("    divisors[%d] = %d;\n", j, divisors[j]);
    }
    putchar('\n');
    printf("#define DIVISOR_COUNT %d\n", divisor_count);
    return 0;
}
